Bug 552667 – gtkimage containing gicon leaks memory
authorChristian Persch <chpe@src.gnome.org>
Wed, 17 Sep 2008 18:09:13 +0000 (18:09 +0000)
committerChristian Persch <chpe@src.gnome.org>
Wed, 17 Sep 2008 18:09:13 +0000 (18:09 +0000)
* gtk/gtkimage.c: (ensure_pixbuf_for_gicon): Fix critical warnings
when looking up the icon fails. Plug a mem leak.

svn path=/trunk/; revision=21415

ChangeLog
gtk/gtkimage.c

index adb5c3654f2625a07affab0f832434460d2e7fba..51d324ff37c6810bab65638899885a4769918f59 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-09-17  Christian Persch  <chpe@gnome.org>
+
+       Bug 552667 – gtkimage containing gicon leaks memory
+
+       * gtk/gtkimage.c: (ensure_pixbuf_for_gicon): Fix critical warnings
+       when looking up the icon fails. Plug a mem leak.
+
 2008-09-17  Matthias Clasen  <mclasen@redhat.com>
 
        Bug 329593 – Entering characters on a line very cpu intensive and 
index 9f4b111362b6835f4f9bdec24c71e440d82646ed..15f3bb27d9aa6c2d74361aeb65b72f9b8069a0d0 100644 (file)
@@ -1611,7 +1611,6 @@ ensure_pixbuf_for_gicon (GtkImage *image)
   gint width, height;
   GtkIconInfo *info;
   GtkIconLookupFlags flags;
-  GError *error = NULL;
 
   g_return_if_fail (image->storage_type == GTK_IMAGE_GICON);
 
@@ -1643,10 +1642,14 @@ ensure_pixbuf_for_gicon (GtkImage *image)
       info = gtk_icon_theme_lookup_by_gicon (icon_theme,
                                             image->data.gicon.icon,
                                             MIN (width, height), flags);
-      image->data.gicon.pixbuf = gtk_icon_info_load_icon (info, &error);
+      if (info)
+        {
+          image->data.gicon.pixbuf = gtk_icon_info_load_icon (info, NULL);
+          gtk_icon_info_free (info);
+        }
+
       if (image->data.gicon.pixbuf == NULL)
        {
-         g_error_free (error);
          image->data.gicon.pixbuf =
            gtk_widget_render_icon (GTK_WIDGET (image),
                                    GTK_STOCK_MISSING_IMAGE,